#include "caixaeletronicobruno.h"

#include <GL/glu.h>
#include "gllib/Objects.h"

void CaixaEletronicoBruno::draw() {

    glEnable(GL_COLOR_MATERIAL);
    glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);

    float mat_specular[] = {0.7, 0.7, 0.7, 1.0};
    float shininess = 20;

    glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
    glMaterialf(GL_FRONT, GL_SHININESS, shininess);

    construirVisor(-1,0.5,0.2);
    construirBaseDinheiro(-1,0,0);

     glDisable(GL_COLOR_MATERIAL);
}

void CaixaEletronicoBruno::construirVisor(float x, float y, float z){

    glPushMatrix();
    glColor3f(1,1,1);
    glTranslatef(x,y,z);
    glScalef(2.5,1.3,0.8);
    gllibCube(0.5);
    glPopMatrix();


    glPushMatrix();
    glColor3f(0,0,0);
    glTranslatef(x-0.35,y+0.17,z-0.18);
    glScalef(1,0.6,0.1);
    gllibCube(0.5);
    glPopMatrix();
}

void CaixaEletronicoBruno::construirBaseDinheiro(float x,float y, float z){
    glPushMatrix();
    glColor3f(1,1,1);
    glTranslatef(x,y,z);
    glScalef(2.5,0.8,1.6);
    gllibCube(0.5);
    glPopMatrix();

    glPushMatrix();
    glColor3f(0,0,0);
    glTranslatef(x,y-0.1,z-0.6);
    glScalef(2.4,0.1,1);
    gllibCube(0.5);
    glPopMatrix();

    glPushMatrix();
    glColor3f(1,1,1);
    glTranslatef(x,y,z-0.85);
    glScalef(2.5,0.6,0.05);
    gllibCube(0.5);
    glPopMatrix();

    glPushMatrix();
    glRotatef(150,1,0,0);
    glTranslatef(x,y-0.37,z-0.06);
    glScalef(2.5,0.05,1.2);
    gllibCube(0.5);
    glPopMatrix();


    glPushMatrix();
    glTranslatef(x-0.5,y+0.3,z+0.1);
    glScalef(0.5,0.69,0.5);
    gllibCylinder(0.1,0.5,50);
    glPopMatrix();

    glPushMatrix();
    glTranslatef(x+0.5,y+0.3,z+0.1);
    glScalef(0.5,0.69,0.5);
    gllibCylinder(0.1,0.5,50);
    glPopMatrix();
}

void CaixaEletronicoBruno::construirBase(float x,float y, float z){

}

